 /**
   * Copyright 2014 Viettel Telecom. All rights reserved.
   * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
   */
 package com.viettel.core.dao.cms; 
import org.springframework.beans.factory.annotation.Autowired;

import com.viettel.core.entities.cms.ProductsPrice;
import com.viettel.core.exceptions.DataAccessException;
import com.viettel.core.repo.IRepository;
 /**
   *  Mo ta muc dich cua lop (interface)
   *  @author: TOANTM1
   *  @version:  
   *  @since: 03/03/2014 - 09:43:43
   */
 public class ProductsPriceDAOImpl implements ProductsPriceDAO { 
	 private IRepository repo; 
		
	 	public void setRepo(IRepository repo) {
			this.repo = repo;
		} 
 
 	/**@author TOANTM1
  	 * 03/03/2014 - 09:43:43
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public ProductsPrice getProductsPriceById(Integer id) throws DataAccessException { 
		return repo.getEntityById(ProductsPrice.class, id); 
	} 
 
 	/**@author TOANTM1
  	 * 03/03/2014 - 09:43:43
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public ProductsPrice createProductsPrice(ProductsPrice productsprice) 
			throws DataAccessException { 
		if (productsprice == null) { 
			throw new IllegalArgumentException("productsprice"); 
		} 
		repo.create(productsprice); 
		return repo.getEntityById(ProductsPrice.class, productsprice.getId()); 
	} 
 
 	/**@author TOANTM1
  	 * 03/03/2014 - 09:43:43
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public void updateProductsPrice(ProductsPrice productsprice) throws DataAccessException { 
		if (productsprice == null) { 
			throw new IllegalArgumentException("productsprice"); 
		} 
		repo.update(productsprice); 
	} 
 
 	/**@author TOANTM1
  	 * 03/03/2014 - 09:43:43
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public void deleteProductsPrice(ProductsPrice productsprice) throws DataAccessException { 
		if (productsprice == null) { 
			throw new IllegalArgumentException("productsprice"); 
		} 
		repo.delete(productsprice); 
	} 
 	
} 
 
